package com.chief.dubbo.gateway;

import com.chief.dubbo.DubboTestGateWayService;
import com.chief.openfeign.OpenFeignTestService;
import com.chief.openfeign.gateway.OpenFeignGatewayTestService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
//如果添加@RequestMapping则请求地址为 http://localhost:8081/a/index
//@RequestMapping("/a")
public class IndexGatewayAction {

    @DubboReference
    private DubboTestGateWayService dubboTestGateWayService;
    @Autowired
    private OpenFeignGatewayTestService openFeignGatewayTestService;
    @Autowired
    private OpenFeignTestService openFeignTestService;

    @GetMapping("/index")
    public Map<String, Object> index() {
        Map<String, Object> res = new HashMap<>();
        res.put("dubboTestGateWayService", this.dubboTestGateWayService.test());
        res.put("openFeignGatewayTestService", this.openFeignGatewayTestService.test());
        res.put("openFeignTestService", this.openFeignTestService.openFeignTest("0000"));
        return res;
    }
}
